WordPress

推荐列表 站点导航

当前位置:首页 > 建站教程 > WordPress >

禁用wordpress gravatar使用本地头像提高网页打开速度

来源:网络整理  作者:  发布时间:2020-12-17 11:00
WordPress默认的头像是读取gravatar.com上的图片的,对于国内用户来说会使网页打开速度变慢。所以我决定删除掉这块功...
* @since 2.5
* @param int|string|object $id_or_email A user ID, email address, or comment object
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
endif;  
*
* @param string $default URL to a default image to use if no avatar is available

WordPress默认的头像是读取gravatar.com上的图片的,对于国内用户来说会使网页打开速度变慢。所以我决定删除掉这块功能。

修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下:

$safe_alt = esc_attr( $alt );
* @return string tag for the user's avatar

即使用该函数,仅可能返回一个默认头像(位于wp-includes/images/blank.gif内),再配合simple local avatars或Add Local Avatar插件,就实现了预期的效果。

/**
$safe_alt = '';
return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
if ( !is_numeric($size) )
*/
else
$default = includes_url('images/blank.gif');

禁用wordpress gravatar使用本地头像提高网页打开速度 (https://www.wpmee.com/) WordPress使用教程 第1张

$size = '96';
* @param string $alt Alternate text to use in image tag. Defaults to blank
* @param int $size Size of the avatar image
* Retrieve the avatar for a user who provided a user ID or email address.
}
$avatar = "";
if ( ! get_option('show_avatars') )
if ( false === $alt)
if ( !function_exists( 'get_avatar' ) ) :
return false;

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jz/wp/4797.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

禁用wordpress gravatar使用本地头像提高网页打开速度

2020-12-17 编辑:

* @since 2.5
* @param int|string|object $id_or_email A user ID, email address, or comment object
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
endif;  
*
* @param string $default URL to a default image to use if no avatar is available

WordPress默认的头像是读取gravatar.com上的图片的,对于国内用户来说会使网页打开速度变慢。所以我决定删除掉这块功能。

修改get_avatar函数,在wp-includes/pluggable.php内。修改后的函数如下:

$safe_alt = esc_attr( $alt );
* @return string tag for the user's avatar

即使用该函数,仅可能返回一个默认头像(位于wp-includes/images/blank.gif内),再配合simple local avatars或Add Local Avatar插件,就实现了预期的效果。

/**
$safe_alt = '';
return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
if ( !is_numeric($size) )
*/
else
$default = includes_url('images/blank.gif');

禁用wordpress gravatar使用本地头像提高网页打开速度 (https://www.wpmee.com/) WordPress使用教程 第1张

$size = '96';
* @param string $alt Alternate text to use in image tag. Defaults to blank
* @param int $size Size of the avatar image
* Retrieve the avatar for a user who provided a user ID or email address.
}
$avatar = "";
if ( ! get_option('show_avatars') )
if ( false === $alt)
if ( !function_exists( 'get_avatar' ) ) :
return false;

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jz/wp/4797.shtml

相关文章

风云图片

推荐阅读

返回WordPress频道首页